package org.creativor.rayson.server;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.creativor.rayson.api.RpcProtocol;
import org.creativor.rayson.api.RpcService;
import org.creativor.rayson.common.ClientSession;
import org.creativor.rayson.common.Invocation;
import org.creativor.rayson.demo.server.DemoServiceImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The class <code>ServiceReflectionTest</code> contains tests for the class
 * <code>{@link ServiceReflection}</code>.
 * <p>
 * Copyright Creativor Studio (c) 2011
 * 
 * @generatedBy CodePro at 11-5-7 上午2:45
 * @author Nick Zhang
 * @version $Revision: 1.0 $
 */
public class ServiceReflectionTest
{
	/**
	 * Launch the test.
	 * 
	 * @param args
	 *            the command line arguments
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	public static void main(String[] args)
	{
		new org.junit.runner.JUnitCore().run(ServiceReflectionTest.class);
	}
	
	/**
	 * Perform pre-test initialization.
	 * 
	 * @throws Exception
	 *             if the initialization fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Before
	public void setUp() throws Exception
	{
		// TODO: add additional set up code here
	}
	
	/**
	 * Perform post-test clean-up.
	 * 
	 * @throws Exception
	 *             if the clean-up fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@After
	public void tearDown() throws Exception
	{
		// TODO: add additional tear down code here
	}
	
	/**
	 * Run the String getDescription() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testGetDescription_1() throws Exception
	{
		ServiceReflection fixture = new ServiceReflection("", "", new DemoServiceImpl());
		
		String result = fixture.getDescription();
		
		// TODO: add additional test code here
		assertEquals("", result);
	}
	
	/**
	 * Run the RpcService getInstance() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testGetInstance_1() throws Exception
	{
		ServiceReflection fixture = new ServiceReflection("", "", new DemoServiceImpl());
		
		RpcService result = fixture.getInstance();
		
		// TODO: add additional test code here
		assertNotNull(result);
	}
	
	/**
	 * Run the String getName() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testGetName_1() throws Exception
	{
		ServiceReflection fixture = new ServiceReflection("", "", new DemoServiceImpl());
		
		String result = fixture.getName();
		
		// TODO: add additional test code here
		assertEquals("", result);
	}
	
	/**
	 * Run the Class<? extends RpcProxy>[] getProxys() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testGetProxys_1() throws Exception
	{
		ServiceReflection fixture = new ServiceReflection("", "", new DemoServiceImpl());
		
		Class<? extends RpcProtocol>[] result = fixture.getProtocols();
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals(2, result.length);
		assertNotNull(result[0]);
		assertEquals("interface org.creativor.rayson.demo.api.DemoProxy", result[0].toString());
		assertEquals(1537, result[0].getModifiers());
		assertEquals(true, result[0].isInterface());
		assertEquals(false, result[0].isArray());
		assertEquals(false, result[0].isPrimitive());
		assertEquals(null, result[0].getSuperclass());
		assertEquals(null, result[0].getComponentType());
		assertEquals("org.creativor.rayson.demo.api.DemoProxy", result[0].getName());
		assertEquals(false, result[0].desiredAssertionStatus());
		assertEquals("org.creativor.rayson.demo.api.DemoProxy", result[0].getCanonicalName());
		assertEquals(null, result[0].getDeclaringClass());
		assertEquals(null, result[0].getEnclosingClass());
		assertEquals(null, result[0].getEnclosingConstructor());
		assertEquals(null, result[0].getEnclosingMethod());
		assertEquals(null, result[0].getEnumConstants());
		assertEquals(null, result[0].getGenericSuperclass());
		assertEquals(null, result[0].getSigners());
		assertEquals("DemoProxy", result[0].getSimpleName());
		assertEquals(false, result[0].isAnnotation());
		assertEquals(false, result[0].isAnonymousClass());
		assertEquals(false, result[0].isEnum());
		assertEquals(false, result[0].isLocalClass());
		assertEquals(false, result[0].isMemberClass());
		assertEquals(false, result[0].isSynthetic());
		assertNotNull(result[1]);
		assertEquals("interface org.creativor.rayson.demo.api.DemoAsyncProxy", result[1].toString());
		assertEquals(1537, result[1].getModifiers());
		assertEquals(true, result[1].isInterface());
		assertEquals(false, result[1].isArray());
		assertEquals(false, result[1].isPrimitive());
		assertEquals(null, result[1].getSuperclass());
		assertEquals(null, result[1].getComponentType());
		assertEquals("org.creativor.rayson.demo.api.DemoAsyncProxy", result[1].getName());
		assertEquals(false, result[1].desiredAssertionStatus());
		assertEquals("org.creativor.rayson.demo.api.DemoAsyncProxy", result[1].getCanonicalName());
		assertEquals(null, result[1].getDeclaringClass());
		assertEquals(null, result[1].getEnclosingClass());
		assertEquals(null, result[1].getEnclosingConstructor());
		assertEquals(null, result[1].getEnclosingMethod());
		assertEquals(null, result[1].getEnumConstants());
		assertEquals(null, result[1].getGenericSuperclass());
		assertEquals(null, result[1].getSigners());
		assertEquals("DemoAsyncProxy", result[1].getSimpleName());
		assertEquals(false, result[1].isAnnotation());
		assertEquals(false, result[1].isAnonymousClass());
		assertEquals(false, result[1].isEnum());
		assertEquals(false, result[1].isLocalClass());
		assertEquals(false, result[1].isMemberClass());
		assertEquals(false, result[1].isSynthetic());
	}
	
	/**
	 * Run the Object invoke(RpcRequest,Invocation) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test(expected = org.creativor.rayson.common.RpcCallException.class)
	public void testInvoke_1() throws Exception
	{
		ServiceReflection fixture = new ServiceReflection("", "", new DemoServiceImpl());
		Invocation invocation = new Invocation();
		
		Object result = fixture.invoke(new ClientSession(), invocation);
		
		// TODO: add additional test code here
		assertNotNull(result);
	}
	
	/**
	 * Run the Object invoke(RpcRequest,Invocation) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test(expected = org.creativor.rayson.common.RpcCallException.class)
	public void testInvoke_2() throws Exception
	{
		ServiceReflection fixture = new ServiceReflection("", "", new DemoServiceImpl());
		Invocation invocation = new Invocation();
		
		Object result = fixture.invoke(new ClientSession(), invocation);
		
		// TODO: add additional test code here
		assertNotNull(result);
	}
	
	/**
	 * Run the Object invoke(RpcRequest,Invocation) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test(expected = org.creativor.rayson.common.RpcCallException.class)
	public void testInvoke_3() throws Exception
	{
		ServiceReflection fixture = new ServiceReflection("", "", new DemoServiceImpl());
		Invocation invocation = new Invocation();
		
		Object result = fixture.invoke(new ClientSession(), invocation);
		
		// TODO: add additional test code here
		assertNotNull(result);
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_1() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_2() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_3() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_4() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_5() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_6() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_7() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the ServiceReflection(String,String,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceReflection_8() throws Exception
	{
		String name = "";
		String description = "";
		RpcService instance = new DemoServiceImpl();
		
		ServiceReflection result = new ServiceReflection(name, description, instance);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
}
